﻿using AutoMapper;
using BlogApi.Models;
using BlogApi.ModelsDto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BlogApi.Profiles
{
    public class TagProfile:Profile
    {
        public TagProfile()
        {
            CreateMap<ArticleTag, TagDto>().ForMember(dest => dest.TagId, opt => opt.MapFrom(src => src.Id))
                .ForMember(dest => dest.CreateTime, opt => opt.MapFrom(src => src.CreateTime.ToString("yyyy-MM-dd")));
            CreateMap<TagAddDto, ArticleTag>();
        }
    }
}
